﻿using SCG.General;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TTEngine
{
    public class SpiderLair : PatternRoom
    {
        //clone
        public override Room Clone()
        {
            return new SpiderLair();
        }

        //post processing
        public override void PostProcessing()
        {
            int radius = Globals.RandomIntFromTo(6, 12);
            int density = Globals.RandomIntFromTo(2, 4);
    
            //create cluster of webs, with spiders
            List<SCGPoint> pts = Level.CreatePointCluster(Globals.RandomIntFromTo(10, 20), CenterX, CenterY, radius, density, '\0');
            foreach(SCGPoint pt in pts)
            {
                SpiderWeb web = new SpiderWeb();
                Level.AddObjectToMap(web, pt.X, pt.Y);
                if (Globals.Random.NextDouble() > 0.5)
                    Level.SpawnMonster(pt.X, pt.Y, "Spider");
            }
    
            //create some isolated spiders
            pts = Level.CreatePointCluster(Globals.RandomIntFromTo(1, 4), CenterX, CenterY, radius * 2, density, '\0');
            foreach(SCGPoint pt in pts)
                Level.SpawnMonster(pt.X, pt.Y, "Spider");
            Level.DistributeLoot(1, 3, CenterX, CenterY, 6, 1);
        }
    }
}
